package com.sl.apt

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.TextView
import com.maniu.butterknife_anno.*
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.http.GET
import retrofit2.http.Path

class MainActivity : AppCompatActivity() {

    @BindView(R.id.textview_1)
    lateinit var textView : TextView
    var count = 1

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        ButterKnife.bind(this)
    }

    @BindClick(R.id.textview_1)
    fun click(v : View){
        textView.text = "${count++}"
    }
    
    
    fun retrofitTest(){
        val retroft = Retrofit.Builder().baseUrl("https://api.github.com/").build()

        val service: GitHubService = retroft.create(GitHubService::class.java)

        service.listRepos("octocat")

    }


    interface GitHubService{

        @GET("users/{user}/repos")
        fun listRepos(@Path("user") user : String) : Call<List<Repo>>
    }

    data class Repo(val x : String){

    }
}